package gtgold;

import static org.junit.Assert.*;

import java.util.Random;

import org.junit.Before;
import org.junit.Test;

/**
 * Tests the status method in the Person class.
 * 
 * @author Isabelle Giuong
 */

public class PersonTest {
	private Person tom;
	
	@Before
	public void setUp() throws Exception {
		tom = new Person("tom");
	}

	@Test
	public void testStatus() {
		// tom starts with great health at the max of 20 points. 
		for(double d = 20.0; d >= 16.0; d --){ 
			tom.setHealth(d); // tom's health value changes
			assertEquals("tom should still have great health", "great", tom.status()); 
		}
		// testing tom's health status when it is less great.
		for(double d = 12.0; d < 16.0; d ++){
			tom.setHealth(d); 
			assertEquals("tom should be in good health", "good", tom.status()); 
		}
		// testing tom's health becoming fair
		for(double d = 8.0; d < 12.0; d ++){
			tom.setHealth(d); 
			assertEquals("tom should be in fair health", "fair", tom.status()); 
		}
		// tom's health decreases to poor
		for(double d = 4; d < 8.0; d ++){
			tom.setHealth(d); 
			assertEquals("tom should be in poor health", "poor", tom.status()); 
		}
		// tom's health decreases to very poor
		for(double d = 0.0; d < 4.0; d ++){
			tom.setHealth(d); 
			assertEquals("tom should be in very poor health", "very poor", tom.status()); 
		}
		// test that when tom's health improve, his status will too
		tom.setHealth(20);
		assertEquals("tom should be in great health again", "great", tom.status());
		// tom gets sick
		tom.disease = "Dysentery";
		assertEquals("Dysentery", tom.status());
		// tom dies
		tom.kill();
		assertEquals("deceased", tom.status());
	}
}